package com.spc.car.data.service.std.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.spc.car.common.utils.StringUtils;
import com.spc.car.data.entity.std.StdGbOrgType;
import com.spc.car.data.mapper.std.StdGbOrgTypeMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spc.car.data.service.std.StdGbOrgTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 机构类型表
经济类型分类与代码 GB/T 12402-2000  服务实现类
 * </p>
 *
 * @author 
 * @since 2020-03-05
 */
@Service
public class StdGbOrgTypeServiceImpl extends ServiceImpl<StdGbOrgTypeMapper, StdGbOrgType> implements StdGbOrgTypeService {

    @Override
    public List<StdGbOrgType> listStdGbOrgTypeByParentCode(String parentCode) {
        LambdaQueryWrapper<StdGbOrgType> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(parentCode), StdGbOrgType::getParentCode, parentCode)
                .isNull(StringUtils.isBlank(parentCode), StdGbOrgType::getParentCode)
                .orderByAsc(StdGbOrgType::getCode);
        return list(wrapper);
    }
}
